

public class TravelAgency implements Travel {
    
    private TravelPerson travelPerson;

    public TravelAgency(TravelPerson travelPerson) {
        this.travelPerson = travelPerson;
    }

    public void buyTrainticket() {
        before();
        this.travelPerson.buyTrainticket();
        after();
    }

    private void before() {
        System.out.println("付定金");
    }

    private void after() {
        System.out.println("付尾款");
    }
}